﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CascadingComboBoxDemo.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public ActionResult GetData()
        {
            var result = new List<KeyValuePair<string, string>>();
            var max = new Random().Next(2, 10);
            for (int i = 0; i < max; i++)
            {
                result.Add(new KeyValuePair<string, string>(i.ToString(), i.ToString()));
            }

            return Json(result, JsonRequestBehavior.AllowGet);
        }
    }
}
